package com.hl.sfzy.service;

import com.hl.sfzy.entity.SearchCourse;
import com.hl.sfzy.entity.SearchMark;
import com.hl.sfzy.entity.SearchProAndAns;
import com.hl.sfzy.entity.SearchTeacher;
import com.hl.sfzy.mapper.SearchTeacherByIdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SearchTeacherByIdService {
    @Autowired
    private SearchTeacherByIdMapper searchTeacherByIdMapper;
    public Map consultantDetails(Integer teacherId){
        List<SearchMark> userMarkList=searchTeacherByIdMapper.selectMarkByUserId(teacherId);
        List<SearchProAndAns> proAndAnsLimit = searchTeacherByIdMapper.selectProAndAnsLimit();
        SearchTeacher teacher = searchTeacherByIdMapper.selectTeacherById(teacherId);
        List<SearchCourse> searchCourse = searchTeacherByIdMapper.selectCourseByTeacherId(teacherId);
        Map map = new HashMap<>();
        map.put("userMarkList", userMarkList);
        map.put("proAndAnsLimit", proAndAnsLimit);
        map.put("teacher", teacher);
        map.put("searchCourse", searchCourse);
        return map;
    }

    public List<SearchMark> searchUserMark(Integer teacherId){
        return searchTeacherByIdMapper.selectMarkByUserId(teacherId);
    }
    public List<SearchProAndAns> searchProAndAnsLimit(){
        return searchTeacherByIdMapper.selectProAndAnsLimit();
    }
    public SearchTeacher searchTeacherById(Integer teacherId){
        System.out.println(teacherId);
        return searchTeacherByIdMapper.selectTeacherById(teacherId);
    }
    public List<SearchCourse> searchCourseByTeacherId(Integer teacherId){
        return searchTeacherByIdMapper.selectCourseByTeacherId(teacherId);
    }
}